Common Koding Problems
'Question: How can I have multiple things happening when something is true?' Answer: To do this, you simply press the number of the line you wish to add to a previous rule, then press the to imbed it into the previous rule. That means that only when the parent rule works, this line will work. 'Question: I can't get two brains to communicate with each other. What is wrong?' Answer: A brain has to have global in front of every variable that is not specific to one prop. If there is no global, then the variable is considered '''local, '''which means that it will only work within that brain. You can also specify another prop brain using the '''world tile picker. '''Find more information about brain referencing here (or variable scope here). 'Question: I saw a video of someone using a tile and when I searched for it, I couldn't find it! What happened?' Answer: In most cases, this is because a '''custom variable '''was used. Custom Variables can be created in '''Values' and work as containers of information. When you create a custom variable, you can specify your own name and it will be stored in the respective folder depending on the type of variable you created. Find more about variables and their types here. If this didn't answer your question, there are other scenarios below.'' 'Question: A brain doesn't recognize the player tile. It will also not appear in the WHEN section when I want to define the player's position. What is wrong?' Answer: The reason that the player tile doesn't appear in the WHEN section, is because it relates to an '''object set '''rather than an '''object. 'player is the set of objects in the world that behave like players (more precisely, an object is in the player object set if the first page of its brain has control tiles). To avoid similar errors, go to your player's brain and create a custom object variable. '''Name it "player", then add the following line: '' ''Now, instead of using the tile in any of your brains in the level, '''you will use '' See this video for more information: 'Question: I used once in a brain but I can't make it work again. Is it possible?' Answer: No. Once will work only once per brain. However, there are other workarounds for using once again. Destroying and creating the prop again will make once work once more. Also, if you want to have something work once when powered on or page entered, use to or entered. Find more information in the links (Beginners here, advanced here). 'Question: I want to make a brain work for X seconds, then stop for X seconds, then work again etc. Is it possible?' Answer: Yes. Use timer [''ON time in seconds]Holdtime in secondsloop '' or timertime in secondsHoldtime in secondsloop, then put the rest of the lines inside this rule. For more information on timers, go here. 'Question: I want to make a sound/visual effect work without looping. Is there an easy way to do it?' Answer: Yes. Simply add the to tile in WHEN and the sound/visual effect will play once and stop. Beware as this is not the main rule. Some sounds/visual FXs will behave differently. To see which sounds can be used with the to tile, go here. To see which Visual FX have different durations, go here. 'Question: I used create tile to spawn an enemy and I saw dozens of enemies spawn and I also got slow FPS. How can I spawn an enemy without this happening?' Answer: You have not put any condition in the When side, thus the create tile is executed continuously, once every tic. So instead of leaving WHEN blank, you can add to and it will only spawn one prop. 'Question: Can I have someting work once every time I power it? Once doesn't work the second time.' Answer: Yes. By using the to tile. So WHEN startedpower DO etc. ''To understand the difference between once and to, see Timing and Logic. 'Question: I saw some special tiles in a video but I can't seem to find them. Those tiles were not custom variables. ''Answer: This relates to three scenarios: '' ''1)Modifiers''' are only found after 'a specific tile is placed in the same WHEN /DO category ''2)Outputs''' are brain tiles that only appear after a specific tile is placed in a parent WHEN/DO line. Find an example of an output here. '' 3)'Some tiles can't appear in WHEN and only can in DO. And some tiles only appear when their type is in accordance with the type required. Finally, '''read-only variables can't be the first tile of a DO side. Maybe you are tryng to work with the wrong tiles in the wrong place?'' 'Question: I used display to add a text in my game, but I can't see it. What happened?' Answer: Did you add a screen position? If not, the text will display above the prop and if you are far away, you may not see it. If you added world space, then it will display at the world position you stated. zero in world position means the coordinates (0; 0; 0), so never use zero with space, only with screen position. '' 'Question: I want to have two items display at the same screen position. How do I avoid stacking? Answer: There are two ways to do it, the easy one is to add the modifier stacking after the display tile. For the other way and more UI information, go here. '' 'Question: I want to have something stop working after something happens. Is there an easy way to do it from another brain? Answer: Yes. If you want the kode to stop permanently, the easier way is to say destroythe prop with In-World Picker. However, if you want the physical mesh to remain but the brain to stop, you can say Prop with World Pickeris activeequalsfalse. That will also allow you to re-enable it later on if needed (mainly for cutscenes to enable/disable player). 'Question: I want to make a multiplayer game, but the logic only works for one player. How can I make it work for all players?' Answer: There are specific tiles that assign kode to each player, find more info in this video. 'Question: I have a sign set to display a message, but it only works for a split second! What is wrong?' Answer: In most cases, this happens because you 've set the sign to work as WHEN interacted DO display etc. The "interacted" tile only works for a single iteration then stops. In order for your sign to work, you have to say: 'Question: I have a player/enemy that when he dies he disappears. How can I change that?' Answer: To solve this issue go to the character > press edit (LB + A on controller) > properties > combat > Health & Defenses > Destroy after death > set it OFF. Category:Brains